<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/generic/taglibs.jsp"%>
<s:layout-render name="/WEB-INF/jsp/generic/layout.jsp">

	<s:layout-component name="pageContent">
		<div class="content">

			<h2>Soumettre une anomalie ou une suggestion d'évolution</h2>
			
			<s:form action="${actionBean.url }" focus="defect.description" class="buglist-form">
				<sd:textarea name="defect.description"
					placeholder="Entrez la description de l'anomalie" />
				<s:select name="defect.criticity">
					<s:options-collection collection="${actionBean.criticities}"
						value="id" label="label" />
				</s:select>
				<s:submit name="addDefect">Soumettre</s:submit>
			</s:form>

			<ss:secure roles="${actionBean.roleAdmin }">
				<h2>Liste des anomalies reportées</h2>

				<fieldset>
					<legend>Liste des anomalies</legend>
					<c:choose>
						<c:when test="${empty actionBean.bugList}">
							<p>Pas d'anomalies rapportées.</p>
						</c:when>
						<c:otherwise>

							<ul>
								<c:forEach items="${actionBean.bugList}" var="bug">
									<li>${bug.criticityLabel } : ${bug.description }</li>
								</c:forEach>
							</ul>

						</c:otherwise>
					</c:choose>

				</fieldset>
			</ss:secure>


		</div>
	</s:layout-component>

</s:layout-render>